package com.qlm.controller;

import java.util.List;

import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.qlm.interceptor.AuthInterceptor;
import com.qlm.service.ShopMgr;
@Before(AuthInterceptor.class)
public class OrderController extends Controller{
	public void index(){
		
	}
	
	public void toAllOrder(){
		String id = getPara("id","p");
		List<Record> orders = null;
		if("p".equals(id)){
			orders = Db.find("select * from t_order order by create_time_ desc");
		}else{
			orders = Db.find("select * from t_order where status_ = "+id+" order by create_time_ desc");
		}
		renderJson(orders);
	}
	
	public void detail(){
		String id = getPara("id");
		Record orderDetail = ShopMgr.getOrderDetail(id);
		renderJson(orderDetail);
	}
	
	public void lognum(){
		String id = getPara("id");
		String num = getPara("num");
		Db.update("update t_order set logistics_number_ = '"+num+"' ,status_ =4 where id = '"+id+"'");
		renderJson(new Record());
	}
}
